package com.caojing.haolemai.ui.outlets;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.caojing.haolemai.bean.TabResultsEntity;
import com.caojing.haolemai.ui.outlets.outletsSharefragment.OutletsShareFragment;

import java.util.List;

/**
 * Created by Administrator on 2016/10/18 0018.
 */
public class OutletsFragmentViewpagerAdapter extends FragmentPagerAdapter{
private List<OutletsShareFragment>outletsShareFragmentList;
    private List<TabResultsEntity> tabResultsEntity;

    public OutletsFragmentViewpagerAdapter(FragmentManager fm,List<OutletsShareFragment>outletsShareFragmentList,List<TabResultsEntity> tabResultsEntity) {
        super(fm);
        this.outletsShareFragmentList=outletsShareFragmentList;
        this.tabResultsEntity=tabResultsEntity;
    }

    @Override
    public Fragment getItem(int position) {
        return outletsShareFragmentList!=null?outletsShareFragmentList.get(position):null;
    }

    @Override
    public int getCount() {
        return outletsShareFragmentList!=null?outletsShareFragmentList.size():0;
    }

    //    这是打算复用fragment的，所以需要从解析的bean类中得到相应的数据
    @Override
    public CharSequence getPageTitle(int position) {
        return tabResultsEntity.get(position).getName();
    }
}
